<?php

/**
 * @Author: Wang Chunsheng 2192138785@qq.com
 * @Date:   2020-03-03 06:43:15
 * @Last Modified by:   Wang Chunsheng 2192138785@qq.com
 * @Last Modified time: 2020-03-03 16:37:55
 */


use common\models\DdGoods;
use yii\helpers\Html;
use common\widgets\MyActiveForm;
use richardfan\widget\JSRegister;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $model common\models\DdGoods */
/* @var $form yii\widgets\MyActiveForm */
?>

<div class="dd-goods-form">
    <div class="form-group">
        <label class="checkbox-inline col-xs-12 col-sm-2 col-md-2 control-label">
            <?= $form->field($model, 'spec_type')->checkbox(['10' => '启用商品规格', '20' => '不启用商品规格']) ?>
        </label>
        <div class="col-sm-9 col-xs-12">
            <span class="help-block">启用商品规格后，商品的价格及库存以商品规格为准,库存设置为0则不显示,-1为不限制</span>
        </div>
    </div>

    <div id='tboption' <?php if ($model->spec_type != 1) : ?>style='display:none' <?php endif; ?>>



        <div class="alert alert-info">
            1. 拖动规格可调整规格显示顺序, 更改规格及规格项后请点击下方的【刷新规格项目表】来更新数据。<br />
            2. 每一种规格代表不同型号，例如颜色为一种规格，尺寸为一种规格，如果设置多规格，手机用户必须每一种规格都选择一个规格项，才能添加购物车或购买。
        </div>
        <div id='specs'>
            <?php echo $this->render('spec', [
                'model' => $model,
                'form' => $form,
                'specitem' => $specitem,
                'spec' => $spec,
                'op' => 'update',
                'specv' => $specv,
                'spec_item_shows' => $spec_item_shows,
                'spec_item_thumbs' => $spec_item_thumbs,

            ]); ?>
        </div>
        <table class="table">
            <tr>
                <td>
                    <h4><a href="javascript:;" class='btn btn-primary' id='add-spec' style="margin-top:10px;margin-bottom:10px;" title="添加规格"><i class='fa fa-plus'></i> 添加规格</a>
                        <a href="javascript:;" id="calcref" title="刷新规格项目表" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新规格项目表</a></h4>
                </td>
            </tr>
        </table>
        <div class="box-body table-responsive" id="options" style="padding:0;">
            <?= $html ?>
        </div>
    </div>
</div>